登录 白背景

458. 可怜的小猪

https://leetcode-cn.com/problems/poor-pigs/

  • 提交时间:2021-11-25 15:20:38
  • 执行用时:0 ms, 在所有 Go 提交中击败了100.00%的用户
  • 内存消耗:1.9 MB, 在所有 Go 提交中击败了13.64%的用户
  • 通过测试用例:17 / 17
func poorPigs(buckets, minutesToDie, minutesToTest int) int {
    states := minutesToTest/minutesToDie + 1
    return int(math.Ceil(math.Log(float64(buckets)) / math.Log(float64(states))))
}